// 浏览器相关IPC主题
export const browserTopic = {
  // 新增窗口
  addBrowser: 'browser:add',
  moveTabs: 'browser:move-tabs',
  // 添加标签页
  addTabs: 'browser:add-tabs',
  // 创建分组
  createGroup: 'browser:create-group',
  // 批量关闭标签页
  closeTabs: 'browser:close-tabs'
}
/**
 * 标签页IPC主题
 * */
export const tabTopic = {
  // 获取标签页数据
  get: 'tab:get-data',
  onUpdate: 'tab:on:update',
  onFindInPage: 'tab:on:find-in-page',
  handle: {
    focus: 'tab:handle:focus', // 获取焦点
    back: 'tab:handle:back', // 后退
    forward: 'tab:handle:forward', // 前进
    refresh: 'tab:handle:refresh', // 刷新
    navigate: 'tab:handle:navigate', // 导航
    stop: 'tab:handle:stop', // 停止
    toggleMute: 'tab:handle:toggle-mute', // 静音
    toggleHistoryEnabled: 'tab:handle:set-history-enabled', // 启用/禁用浏览历史
    setWidth: 'tab:handle:set-width', // 设置宽度
    toggleUserAgent: 'tab:handle:set-user-agent', // 设置UA
    toggleSeparateWindow: 'tab:handle:toggle-separate-window', // 创建/关闭独立窗口
    togglePinned: 'tab:handle:toggle-pinned', // 置顶/取消置顶
    translatePage: 'tab:handle:translate-page', // 翻译页面
    restoreOriginal: 'tab:handle:restore-original', // 还原翻译
    tabTranslationState: 'tab:handle:tab-translation-state', // 翻译状态更变
    findInPage: 'tab:handle:find-in-page', // 查找
    stopFindInPage: 'tab:handle:stop-find-in-page', // 停止查找
    closeTab: 'tab:handle:close-tab',
    setEscPriority: 'tab:handle:set-esc-priority', // 设置 ESC 优先级
    setToolbarConfig: 'tab:handle:set-toolbar-config' // 设置工具栏配置
  }
}

/**
 * 通用右键菜单IPC主题
 */
export const contextMenuTopic = {
  // 显示通用右键菜单
  show: 'context-menu:show',
  // 菜单项回调事件前缀
  callback: 'context-menu:callback',
  // 菜单关闭事件前缀
  closed: 'context-menu:closed'
} as const

/**
 * 工具栏按钮IPC主题
 */
export const toolbarTopic = {
  // 按钮点击事件前缀
  buttonClick: 'toolbar:button-click'
} as const

/**
 * 进程监控IPC主题
 */
export const processTopic = {
  // 获取进程详细信息
  get: 'process:get',
  // 进程监控相关
  monitor: {
    start: 'process:monitor:start',
    stop: 'process:monitor:stop',
    update: 'process:monitor:update'
  }
} as const

/**
 * ID生成服务IPC主题
 */
export const idGeneratorTopic = {
  // 生成新的唯一ID
  generate: 'idGenerator:generate'
} as const

export const PASSWORD_MANAGER_CHANNELS = {
  ADD_CREDENTIAL: 'password-manager:add-credential',
  UPDATE_CREDENTIAL: 'password-manager:update-credential',
  DELETE_CREDENTIAL: 'password-manager:delete-credential',
  QUERY_CREDENTIALS: 'password-manager:query-credentials',
  GET_DECRYPTED_CREDENTIALS: 'password-manager:get-decrypted-credentials',
  UPDATE_LAST_USED: 'password-manager:update-last-used',
  GET_SETTINGS: 'password-manager:get-settings',
  GENERATE_PASSWORD: 'password-manager:generate-password',
  CHECK_PASSWORD_STRENGTH: 'password-manager:check-password-strength',
  SHOW_SAVE_PROMPT: 'password-manager:show-save-prompt',
  SYNC_TO_CLOUD: 'password-manager:sync-to-cloud',
  SYNC_FROM_CLOUD: 'password-manager:sync-from-cloud'
} as const

/**
 * IPC 通道名称常量
 */
export const BROWSING_HISTORY_CHANNELS = {
  // 删除操作
  DELETE_RECORD: 'browsing-history:delete-record',
  DELETE_RECORDS: 'browsing-history:delete-records',
  CLEAR_ALL_RECORDS: 'browsing-history:clear-all-records',

  // 查询操作
  FIND_BY_ID: 'browsing-history:find-by-id',
  FIND_BY_URL: 'browsing-history:find-by-url',
  QUERY_RECORDS: 'browsing-history:query-records',
  SEARCH_RECORDS: 'browsing-history:search-records',
  GET_RECENT_RECORDS: 'browsing-history:get-recent-records',
  GET_MOST_VISITED_RECORDS: 'browsing-history:get-most-visited-records',
  GET_RECORD_COUNT: 'browsing-history:get-record-count',

  // 修改操作
  UPDATE_RECORD: 'browsing-history:update-record'
} as const

/**
 * 书签 IPC 通道常量
 */
export const BOOKMARK_MANAGER_CHANNELS = {
  // 文件夹操作
  ADD_FOLDER: 'bookmark-manager:add-folder',
  UPDATE_FOLDER: 'bookmark-manager:update-folder',
  DELETE_FOLDER: 'bookmark-manager:delete-folder',
  QUERY_FOLDERS: 'bookmark-manager:query-folders',
  // 书签操作
  ADD_BOOKMARK: 'bookmark-manager:add-bookmark',
  UPDATE_BOOKMARK: 'bookmark-manager:update-bookmark',
  DELETE_BOOKMARK: 'bookmark-manager:delete-bookmark',
  QUERY_BOOKMARKS: 'bookmark-manager:query-bookmarks',
  // 同步与导入
  SYNC_TO_CLOUD: 'bookmark-manager:sync-to-cloud',
  SYNC_FROM_CLOUD: 'bookmark-manager:sync-from-cloud',
  IMPORT_FROM_CHROME: 'bookmark-manager:import-from-chrome',
  IMPORT_FROM_EDGE: 'bookmark-manager:import-from-edge'
} as const

/**
 * 通知窗口 IPC 通道常量
 * */
export const NOTIFICATION_WINDOW_CHANNELS = {
  SHOW: 'notifications:show',
  CLEAR: 'notifications:clear',
  WARMUP: 'notifications:warmup',
  ACTION_CLICK: 'notifications:action-click',
  SET_SIZE: 'notifications:set-size',
  NOTIFY: 'notifications:notify'
}
